/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ru.jSkyRoom.bridge.major;

import ru.jSkyRoom.interfaces.major.Light;
import ru.jSkyRoom.interfaces.sub.JSkyModel;
import skyproc.LIGH;
import skyproc.LIGH.LIGHFlag;
import skyproc.Model;

/**
 *
 * @author Rakev
 */
public class LightBridge extends NamedMajorBridge<LIGH> implements Light {

    public LightBridge(LIGH adapting) {
        super(adapting);
    }

    @Override
    public JSkyModel getModel() {
        Model model = getRawObject().getModelData();
        return getBridgeFactory().createBridge(model);
    }

    @Override
    public boolean getFlag(LIGHFlag flag) {
        return getRawObject().get(flag);
    }

    @Override
    public void setFlag(LIGHFlag flag) {
        getRawObject().set(flag, true);
    }

    @Override
    public void unsetFlag(LIGHFlag flag) {
        getRawObject().set(flag, false);
    }

    @Override
    public int getValue() {
        return getRawObject().getValue();
    }

    @Override
    public void setValue(int value) {
        getRawObject().setValue(value);
    }

    @Override
    public float getRed() {
        return getRawObject().getRed();
    }

    @Override
    public void setRed(float red) {
        getRawObject().setRed((int) (255 * red));
    }

    @Override
    public float getBlue() {
        return getRawObject().getBlue();
    }

    @Override
    public void setBlue(float blue) {
        getRawObject().setBlue((int) (255 * blue));
    }

    @Override
    public float getGreen() {
        return getRawObject().getGreen();
    }

    @Override
    public void setGreen(float green) {
        getRawObject().setGreen((int) (255 * green));
    }

    @Override
    public int getTime() {
        return getRawObject().getTime();
    }

    @Override
    public void setTime(int time) {
        getRawObject().setTime(time);
    }

    @Override
    public float getWeight() {
        return getRawObject().getWeight();
    }

    @Override
    public void setWeight(float weight) {
        getRawObject().setWeight((float) weight);
    }
}
